<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<title>记录</title>
<link rel="stylesheet" type="text/css" href="css/damo.css">
</head>
<body>
<style type="text/css">
html {
  margin: 0;
  padding: 0;
  font-size: 62.5%;
  height: 100%;
}
body {
	background-image: url("http://www.photo.ccoo.cn/Edu/2009316/200931617000552.jpg");
  background-repeat:no-repeat;
  background-size:100% 100%;
}
p {
  font-size: 4rem;
  padding-top: 1%;
  text-align: center;
  color: red;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0,0,0,.2);
}
h1{
	font-size: 4rem;
  padding-top: 15%;
  text-align: center;
  color:orange;
}</style>
<h1>2013年9月4日来到榆林学院，大学已经过去了</h1>
<p id="main"><span ></span></p>
<script type="text/javascript">
function toDouble(num) {
  num >= 10 ? num = '' + num : num = '0' + num;
  return num;
}
var main = $$('main'),
  span = $$('main').getElementsByTagName('span')[0];
 
function timer(year, month, day, hour, minute, seconds, elem) {
  var hour = hour || 0,
    minute = minute || 0,
    seconds = seconds || 0;
  var endTime = new Date();
 
  endTime.setFullYear(parseInt(year)),
  endTime.setMonth(parseInt(month) - 1),
  endTime.setDate(parseInt(day)),
  endTime.setHours(parseInt(hour)),
  endTime.setMinutes(parseInt(minute)),
  endTime.setSeconds(parseInt(seconds));
  setTime();
  setInterval(function() {
    setTime()
  }, 1000);
  function setTime() {
    var startTime = new Date();
    var lengthTime = parseInt((startTime.getTime() - endTime.getTime()) / 1000);
    var lSeconds = parseInt(lengthTime % 60),
      lMinute = parseInt((lengthTime / 60) % 60),
      lHour = Math.floor((lengthTime / 3600) % 24),
      lDay = Math.floor(lengthTime / (24 * 3600));
    span.innerHTML=lDay+'天'+toDouble(lHour)+'小时'+toDouble(lMinute)+'分钟'+toDouble(lSeconds)+'秒';
  }
 
}
function $$(id) {
  return document.getElementById(id);
}
timer(2013, 09, 04, 0, 0, 0, span);
</script>
</body>
</html>